<?php
namespace Model;

use Hoa\Registry\Registry;
use Library\Db;

/**
 * Prod
 * @author los_gsy
 */
class Prod extends BaseModel {
	/**
	 * 构造函数
	 */
	public function __construct() {
		parent::__construct();
	}


	/**
	 * test
	 */
	static public function test() {
		return __METHOD__;
	}


	/**
	 * 查询产品信息
	 * @param int $id
	 * @return mixed
	 */
	static public function getProd($id) {
		$conf = Registry::get('conf');
		$dbConf = $conf['database']['mydb'];
		$db = new Db($dbConf);
		$db->where('id', $id);
		$prod = $db->getOne('prod');
		return $prod;
	}


	/**
	 * 修改产品
	 * @param array $data
	 * @param int $id
	 * @return bool
	 */
	static public function saveProd($data, $id) {
		$conf = Registry::get('conf');
		$dbConf = $conf['database']['mydb'];
		$db = new Db($dbConf);
		$db->where('id', $id);
		$result = $db->update('prod', $data);
		return $result;
	}



}